﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Finance_clearmessage : System.Web.UI.Page
{
    Function f = new Function();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            lblPath.Text = f.getModuleidAdd(Request.QueryString["moduid"].ToString());
                initData();
        }
    }
    private void initData()
    {
        ZSql tol = new ZSql();
        string sql = "select  WarehouseName,Convert(char(10),storageTime,120) as cdate,ProcMoney,ProcNum,(ProcNum*ProcMoney) as tol,d.Brand,e.ComoditiesName,f.Specifications,j.Units,h.Supplier,ComodBarcode,sum(TotalNum)as num from CS_stock a join CS_Warehouse b on a.warehouseid=b.WarehouseId join ComoditiesType c on a.ComoditiesType=c.TypeId join Brand d on a.BrandId=d.BrandId join ComoditiesName e on a.ComoditiesName=e.ComoditiesNameId join Specifications f on a.ModelId=f.SpecificationsId join Units j on a.UnitId=j.UnitsId join CS_Supplier h on a.SuppliId=h.SupplierId where f.Specifications='" + Request["Specifications"] + "' group by ComodBarcode,d.brand,WarehouseName,e.ComoditiesName,f.Specifications,h.Supplier,j.Units,WarehouseName,Convert(char(10),storageTime,120),ProcMoney,ProcNum ";
        tol.Open(sql);
        PageNavigator1.Total = 1;
        PageNavigator1.Query = sql + "   order by cdate desc";
        if (tol.m_table.Rows.Count > 0)
        {
            double mone = 0;
            for (int i = 0; i < tol.m_table.Rows.Count; i++)
            {
                
                mone += Convert.ToDouble(tol.m_table.Rows[i]["tol"]);
            
            }
            lbltotal.Text = mone.ToString();
        }
    }
    private void initData1()
    {
        string sql = "select  WarehouseName,d.Brand,e.ComoditiesName,f.Specifications,j.Units,h.Supplier,ComodBarcode,sum(TotalNum)as num from CS_stock a join CS_Warehouse b on a.warehouseid=b.WarehouseId join ComoditiesType c on a.ComoditiesType=c.TypeId join Brand d on a.BrandId=d.BrandId join ComoditiesName e on a.ComoditiesName=e.ComoditiesNameId join Specifications f on a.ModelId=f.SpecificationsId join Units j on a.UnitId=j.UnitsId join CS_Supplier h on a.SuppliId=h.SupplierId where f.Specifications='" + Request["Specifications"] + "' group by ComodBarcode,d.brand,WarehouseName,e.ComoditiesName,f.Specifications,h.Supplier,j.Units ";


        PageNavigator1.Total = 1;
        PageNavigator1.Query = sql + "   order by warehousename";
    }

}
